clear*
set maxvar 11000

global date _2025_10_28
cd "/Users/atri0032/Dropbox/World Bank/Temperature, poverty, and inequality/Estimations/"

******************************************************************************************
********************************** Table S5: Causal mediation analysis
******************************************************************************************

// NDVI
use "${date}/_data/spid_for_analysis_v2.dta", clear
local controls ln_GDPppp Unempilo agri manuf popgr 

reg poor215 temp ndvi rainfall_sum humid `controls' 
keep if e(sample) 
paramed poor215, avar(temp) mvar(ndvi) cvars(rainfall_sum humid) a0(0) a1(1) m(1) yreg(linear) mreg(linear) nointer
paramed poor215, avar(temp) mvar(soil) cvars(rainfall_sum humid) a0(0) a1(1) m(1) yreg(linear) mreg(linear) nointer

// Soil
use "${date}/_data/spid_for_analysis_v2.dta", clear
local controls ln_GDPppp Unempilo agri manuf popgr 

reg gini temp ndvi rainfall_sum humid `controls' 
keep if e(sample) 
paramed gini, avar(temp) mvar(ndvi) cvars(rainfall_sum humid) a0(0) a1(1) m(1) yreg(linear) mreg(linear) nointer
paramed gini, avar(temp) mvar(soil) cvars(rainfall_sum humid) a0(0) a1(1) m(1) yreg(linear) mreg(linear) nointer
